package com.kim.caller.server;

import com.codingapi.txlcn.tc.config.EnableDistributedTransaction;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

/**
 * @Project: kim-distributed-transaction
 * @PackageName: com.kim.caller.server
 * @FileName: OrderCallerApplication.java
 * @Description: The OrderCallerApplication is...
 * @Author: kimwu
 * @Time: 2020-12-29 09:16:34
 */
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients(basePackages = {"com.kim.caller.server.service.feign"})
@EnableDiscoveryClient
@EnableDistributedTransaction //分布式事务
@MapperScan("com.kim.caller.server.mapper")
public class OrderCallerApplication {

    public static void main(String []args){
        SpringApplication.run(OrderCallerApplication.class,args);
    }

    @Bean
    @ConditionalOnMissingBean
    public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
        DefaultAdvisorAutoProxyCreator daap = new DefaultAdvisorAutoProxyCreator();
        daap.setProxyTargetClass(true);
        return daap;
    }
}
